/**
 * Created by Quanta on 2017/5/24.
 */
var date = {};
date.getToday = function (p) {
    var tempData = p?p:new Date();
    var year = tempData.getFullYear();
    var month = (tempData.getMonth()>8)?(tempData.getMonth() + 1):('0'+(tempData.getMonth() + 1));
    var day = (tempData.getDate()>9)?tempData.getDate():('0'+tempData.getDate());
    return year + '-' + month + '-' + day;
}
date.getTime = function (p) {
    var tempData = p?p:new Date();
    var hour = (tempData.getHours()>9)?tempData.getHours():('0'+tempData.getHours());
    var minute = (tempData.getMinutes()>9)?tempData.getMinutes():('0'+tempData.getMinutes());
    var second = (tempData.getSeconds()>9)?tempData.getSeconds():('0'+tempData.getSeconds());
    return hour + ':' + minute + ':' + second;

}
date.getTodayAll = function (p) {
    var tempData = p?p:new Date();
    return date.getToday(tempData) + ' ' + date.getTime(tempData);
}
module.exports = date;